//
//  MyParnerViewController.m
//  Consume100
//
//  Created by eliot on 16/3/28.
//  Copyright © 2016年 aleven. All rights reserved.
//

#import "MyParnerViewController.h"

@interface MyParnerViewController ()


@property (weak, nonatomic) IBOutlet UIImageView *bgIV;

@property (nonatomic, strong) UIButton *submitBtn;
@property (nonatomic, strong) UITextField *textField;

/** 微信分享按钮*/
@property (nonatomic, strong) UIButton *weiChatBtn;
/** 朋友圈分享按钮*/
@property (nonatomic, strong) UIButton *circleOfFriendsBtn;

@end

@implementation MyParnerViewController

-(UIButton *)weiChatBtn {
    if (!_weiChatBtn) {
        _weiChatBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [self.bgIV addSubview:_weiChatBtn];
        [_weiChatBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(Width/2.0 - 10 - 60);
            make.bottom.mas_equalTo(- 100 / 667.0 * Height);
            make.size.mas_equalTo(CGSizeMake(60, 60));
        }];
        [_weiChatBtn setImage:[UIImage imageNamed:@"icon_Share_wechat"] forState:UIControlStateNormal];
        [_weiChatBtn addTarget:self action:@selector(clickWeiChatBtn) forControlEvents:UIControlEventTouchUpInside];
    }
    return  _weiChatBtn;
}

- (void)clickWeiChatBtn {
    
    

}

- (UIButton *)circleOfFriendsBtn {
    if (!_circleOfFriendsBtn) {
        _circleOfFriendsBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [self.bgIV addSubview:_circleOfFriendsBtn];
        [_circleOfFriendsBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(Width/2.0 + 10 );
            make.bottom.mas_equalTo(- 100 / 667.0 * Height);
            make.size.mas_equalTo(CGSizeMake(60, 60));
        }];
        [_circleOfFriendsBtn setImage:[UIImage imageNamed:@"icon_Share_pyq"] forState:UIControlStateNormal];
        [_circleOfFriendsBtn addTarget:self action:@selector(clickcircleOfFriendsBtn) forControlEvents:UIControlEventTouchUpInside];
    }
    return  _circleOfFriendsBtn;
}

- (void)clickcircleOfFriendsBtn {

}

- (UIButton *)submitBtn {
    if (!_submitBtn) {
        _submitBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [self.bgIV addSubview:_submitBtn];
        [_submitBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.mas_equalTo(- 60/ 320.0 * Width);
            make.top.mas_equalTo(290 / 667.0 * Height);
            make.size.mas_equalTo(CGSizeMake(60, 30));
        }];
        [_submitBtn setTitle:@"确定" forState:UIControlStateNormal];
        _submitBtn.backgroundColor = [UIColor colorWithRed:136 /255.0 green:136 /255.0 blue:136 /255.0 alpha:1];
        _submitBtn.layer.cornerRadius = 5;
        _submitBtn.layer.masksToBounds = YES;
        [_submitBtn addTarget:self action:@selector(clickSubmitBtn) forControlEvents:UIControlEventTouchUpInside];
    }
    return  _submitBtn;
}

- (void)clickSubmitBtn {
    
    
    
}

- (UITextField *)textField {
    if (!_textField) {
        _textField = [[UITextField alloc] init];
        [self.bgIV addSubview:_textField];
        [_textField mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo( 60/ 320.0 * Width);
            make.top.mas_equalTo(290 / 667.0 * Height);
            make.right.mas_equalTo(self.submitBtn.mas_left).mas_equalTo(-2);
            make.height.mas_equalTo(30);
            _textField.layer.cornerRadius = 5;
            _textField.layer.masksToBounds = YES;
        }];
    }
    _textField.backgroundColor = [UIColor whiteColor];
    
    
    /** 一键分享*/
    UILabel *centerLb = [[UILabel alloc] init];
    [self.bgIV addSubview:centerLb];
    centerLb.font = [UIFont systemFontOfSize:14];
    centerLb.text = @"一键分享";
    [centerLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(Width/2 - 30);
        make.bottom.mas_equalTo(- 100 / 667.0 * Height - 20 - 60);
        make.size.mas_equalTo(CGSizeMake(60, 20));
    }];
    UILabel *leftLb = [[UILabel alloc] init];
    [self.bgIV addSubview:leftLb];
    leftLb.backgroundColor = [UIColor grayColor];
    [leftLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(centerLb.mas_left).mas_equalTo(- 20);
        make.bottom.mas_equalTo(- 100 / 667.0 * Height - 30- 60);
        make.size.mas_equalTo(CGSizeMake(60, 1));
    }];
    UILabel *rightLb = [[UILabel alloc] init];
    [self.bgIV addSubview:rightLb];
    rightLb.backgroundColor = [UIColor grayColor];
    [rightLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(centerLb.mas_right).mas_equalTo(20);
        make.bottom.mas_equalTo(- 100 / 667.0 * Height - 30 - 60);
        make.size.mas_equalTo(CGSizeMake(60, 1));
    }];
    
    
    return  _textField;
}

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
    [self.textField resignFirstResponder];
}

/**
 *  MARK：XIB创建
 *
 *  @return
 */

+(MyParnerViewController*)CreatMyParnerViewController{
    
    UIStoryboard *story=[UIStoryboard storyboardWithName:@"Main" bundle:nil];
    
    MyParnerViewController *myParnerViewController=[story instantiateViewControllerWithIdentifier:@"MyParnerViewController"];
    
    return myParnerViewController;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.bgIV.userInteractionEnabled = YES;
    self.submitBtn.hidden = NO;
    self.textField.hidden = NO;
    self.weiChatBtn.hidden = NO;
    self.circleOfFriendsBtn.hidden = NO;
    
    self.title = @"我的小伙伴";
    /** 设置导航啦样式*/
    [self.navigationController.navigationBar setTitleTextAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:19],NSForegroundColorAttributeName:[UIColor whiteColor]}];
    self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
    [self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor whiteColor]}];
    self.navigationController.navigationBar.translucent = NO;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
